using System;
using System.Collections.Generic;
using System.Text;


namespace CreamX.Framework.Game.GUI
{
    public class GUI
    {
        public Dictionary<string,GUIButton> Buttons = new Dictionary<string,GUIButton>();
        public Dictionary<string, GUIPanel> Panels = new Dictionary<string, GUIPanel>();
        public GUI()
        {

        }

        public void AddPanel(GUIPanel button)
        {
            //button.Clicked += new GUIButton.ClickedHandler(button_Clicked);
            Panels.Add(button.Name, button);
        }
        public void AddButton(GUIButton button)
        {
            if (button == null)
                return;
            button.Clicked += new GUIButton.ClickedHandler(button_Clicked);
            button.Hover += new GUIButton.MouseHandler(button_Hover);
            Buttons.Add(button.Name, button);
        }

        void button_Hover(GUIButton sender)
        {
            if (ButtonHover!= null)
                ButtonHover(sender);
        }

        void button_Clicked(GUIButton sender)
        {
            if (ButtonClicked != null)
                ButtonClicked(sender);
        }
        

        public event ButtonClickedHandler ButtonClicked;
        public event ButtonClickedHandler ButtonHover;
    }
    public delegate void ButtonClickedHandler(GUIButton button);

    public class GUIPanel : CreamXObject
    {
        public override object Clone()
        {
            GUIPanel __pnl = new GUIPanel();
            __pnl.Material = Material;
            __pnl.Name = Name;
            __pnl.SetPosition(Position);
            __pnl.Scale = Scale;
            __pnl.Template = false;
            __pnl.Components.Clear();
            return __pnl;
        }
        public Dictionary<string, GUIButton> Buttons = new Dictionary<string, GUIButton>();
        public string Title;
        public string Message;
        
        public GUIPanel()
        {
        }

    }
    public class GUITextObject : CreamXObject
    {
        public string Text;
        public GUITextObject()
        {
        }
    }
}
